package org.batatasframework.support.definition;

import org.batatasframework.support.database.JoinType;
import org.batatasframework.support.database.sql.TableRuntimeJoin;
import org.batatasframework.support.database.sql.spi.TableCriterion;

/**
 * <pre>
 * 指向关联表
 * </pre>
 * @author jackson
 *
 */
public interface JoinDefinition extends TableDefinitionResource{

	/**
	 * 如：mastertable left[right inner] join jointable on(mastertable.masterField=jointable.joinField)
	 */
	JoinDefinition on(JoinType type, String masterField, String joinField);
	
	/**
	 * <pre>
	 * 格式参考：{@link #on(JoinType, String, String)}
	 * 
	 * 这里使用的是默认值，如下：
	 * mastertable left join jointable on(mastertable.masterField=jointable.C_ID)
	 * </pre>
	 */
	JoinDefinition on(String masterField);
	
	//TODO 这个方法需要修改
	TableRuntimeJoin loadJoinTable(TableCriterion tableCriterion, boolean createIfNeed)throws Exception;
}
